import request from "@/utils/request";
import type { SearchEmpModel, ResultModel, EmpModel } from "@/api/model/model";

export const queryEmp = (
  name?: string,
  gender?: string,
  begin?: string,
  end?: string,
  page?: number,
  pageSize?: number
) =>
  request.get<any, ResultModel>(
    `/emps?name=${name}&gender=${gender}&begin=${begin}&end=${end}&page=${page}&pageSize=${pageSize}`
  );
export const addEmp = (emp: EmpModel) =>
  request.post<any, ResultModel>("/emps", emp);
export const getEmpById = (id: number) =>
  request.get<any, ResultModel>(`/emps/${id}`);
export const updateEmp = (emp: EmpModel) =>
  request.put<any, ResultModel>("/emps", emp);
export const deleteEmpByIds = (ids: string) =>
  request.delete<any, ResultModel>(`/emps?ids=${ids}`);
export const queryEmpLists = async () => {
  return await request.get(`/emps/list`);
};
